package cn.itcast.controller;

import cn.itcast.entity.Result;
import cn.itcast.pojo.Address;
import cn.itcast.service.AddressService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/address")
public class AddressController {


    @Reference
    private AddressService addressService;
    /**
     * 查询预约分院下拉框
     * 请求方式: Get
     * 请求路径: /address/findAll
     * 返回值:  Address集合
     */
    @GetMapping("/findAll")
    public Result AddressFindAll(){
        List<Address> list = addressService.findAllAddress();
        if (StringUtils.isEmpty(list)){
            return new Result(false,"查询分院失败",null);
        }
        return new Result(true,"查询分院成功",list);
    }
}
